package com.bw.controller;

import com.bw.bean.bean;
import com.bw.service.InfoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class MyController {
    @Autowired
    InfoService infoService;
    @GetMapping("/findinfo")
    public List<Map<String,Object>> findinfo() {
        List<Map<String, Object>> findinfo = infoService.findinfo();
        for (Map<String, Object> stringObjectMap : findinfo) {
            System.out.println(stringObjectMap);
        }
        return findinfo;
    }
    @RequestMapping("/find10")
    public Map find10() {
        List<bean> infoService10 = infoService.find10();
        return SugarUtil.getMapData(infoService10);
    }
    @RequestMapping("/find11")
    public Map find11() {
        List<bean> infoService11 = infoService.find11();
        return SugarUtil.getPieData(infoService11);
    }
    @RequestMapping ("/find12")
    public Map find12() {
        Double infoService12 = infoService.find12();
        return SugarUtil.getFlipNumberData(infoService12);
    }
    @GetMapping("/find13")
    public List<Map<String,Object>> find13() {
        List<Map<String, Object>> infoService13 = infoService.find13();
        return infoService13;
    }
    @GetMapping("/find14")
    public List<Map<String,Object>> find14() {
        List<Map<String, Object>> infoService14 = infoService.find14();
        return infoService14;
    }
    @GetMapping("/find15")
    public List<Map<String,Object>> find15() {
        List<Map<String, Object>> infoService15 = infoService.find15();
        return infoService15;
    }
}
